<?php 
class App_Admin_Pager_Lang extends Main_Pager
{
	/**
	 * @var array
	 */
	protected $_fields = array(
		'id'   => array('simpleSearch' => true, 'sql' => 'lang.id'),
		'abbr' => array('simpleSearch' => true, 'sql' => 'lang.abbr'),
		'name' => array('simpleSearch' => true, 'sql' => 'lang_i18n.name'),
	);
	
	/**
	 * @return void
	 */
	protected function _init()
	{
		$this->_config['base'] = "
			SELECT 
				lang.id
				, lang.abbr
				, lang_i18n.name
			FROM
				lang
			INNER JOIN
				lang_i18n 
				ON
					(lang.id=lang_i18n.lang_id)
			WHERE true		
		";
				
		$this->_config['count'] = "
			SELECT 
				COUNT(lang.id)
			FROM
				lang
			INNER JOIN
				lang_i18n 
				ON
					(lang.id=lang_i18n.lang_id)
			WHERE true	
		";		

		$this->_service = new App_Admin_Service_Lang();
						
		parent::_init();			
	}
	
	/**
	 * @param int|string $primary
	 * @return bool
	 */
	protected function _deleteItem($primary) 
	{
		return $this->_service->deleteItem($primary);
	}
}


